package pachong;
import java.io.*;
import java.sql.SQLException;

import weibo4j.Account;
import weibo4j.Users;
import weibo4j.Weibo;
import weibo4j.model.RateLimitStatus;
import weibo4j.model.User;
import weibo4j.model.WeiboException;
//Access token key: 62e95f355bb7f420d54b78f4bd11d608
//Access token secret: 1d8f8f4ccb8c899fc995c8ba68ba84a3


/*将要爬取用户的screen_name写在screen_name。txt
 * 
 * 
 * */

public class main {

	private static BufferedReader bin;

	public static void main(String[] args) throws WeiboException, IOException, ClassNotFoundException, SQLException {
		String access_token = "2.00fwzwOCFgIJQDa9db6637edS_TjiB";
		String current_screen_name = null;
		
//		String tag_args[] = new String[2];

/*		Users us = new Users();
		us.setToken(access_token);
		User user = us.showUserByScreenName("李开复");

		
		tag_args[0] = access_token;
		tag_args[1] = user.getId();
		
		get_tag tag = new get_tag();
		tag.solve(tag_args);

*/	
		String weibo_args[] = new String[3];
		weibo_args[0] = access_token;

		get_weibo g_wb = new get_weibo();
		bin = new BufferedReader(new InputStreamReader(new FileInputStream("screen_name_list.txt"), "gbk"));
		weibo_args[2] = "N";//是否清空表单
		
		
//		BufferedReader flag = new BufferedReader(new InputStreamReader(new FileInputStream("current_one.txt"), "gbk"));

//		int current_one = flag.read();
//		flag.close();
		
//		File file = new File("current_one.txt");  
//		BufferedWriter output = new BufferedWriter(new FileWriter(file));
//		for (int i = current_one;i > 0; i--) bin.readLine();
		
		Account weibo = new Account();
		weibo.setToken(access_token);
		RateLimitStatus limitStatus =  weibo.getAccountRateLimitStatus();
		System.out.println(limitStatus.getRemainingUserHits());
		
		for (int i = 0; i < 1; i++)
		{
			System.out.println(limitStatus.getUserLimit());
			current_screen_name = bin.readLine();
			weibo_args[1] = current_screen_name;
			g_wb.solve(weibo_args, limitStatus);
		}
		bin.close();

		
		System.out.println();
	}
	

}
